// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2005-1-12

#ifndef __TRANS_ANALYZER_H_SERVER_SVR_MAIN__
#define __TRANS_ANALYZER_H_SERVER_SVR_MAIN__

#pragma once

#include <common/svr_base/base_buffer.h>

namespace JoyServer
{

class CJoyMainRoom;
class CJoyMainUser;

enum JoyTransType
{
    Trans_UDP,
    Trans_TCP,
    Trans_IPX,
    Trans_SPX,
};

class CJoyTransContext
{
public:
    CJoyMainUser*   m_srcUser;
    CJoyMainUser*   m_dstUser;
    JoyTransType    m_transType;
    LPCVOID m_inBuf;
    int     m_inLen;
    CJoyBuffer m_outBuf;
public:
    CJoyTransContext():
        m_srcUser(NULL),
        m_dstUser(NULL),
        m_transType(Trans_UDP),
        m_inBuf(NULL),
        m_inLen(0)
    {
    }
    ~CJoyTransContext()
    {
    }
};
class CJoyTransAnalyzer
{
public:
    CJoyMainRoom*   m_room;

    virtual void OnTransmit(CJoyTransContext& ctx);
public:
    CJoyTransAnalyzer();
    virtual ~CJoyTransAnalyzer();

    virtual bool Create(CJoyMainRoom* pRoom);
    virtual void Destroy();

};


} // namespace JoyServer

#endif  // __TRANS_ANALYZER_H_SERVER_SVR_MAIN__